package icom.acm.util.spring;
/**
 * @author shench
 * Spring构建类
 */
import icom.acm.util.StaticData;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

public class SpringBuild {
	private String xml = "bean.xml";
	private ApplicationContext ctx;
	/**
	 * 用于 linux 的构建
	 */
	public SpringBuild(){
		xml = "/" + StaticData.WEBINF_PATH + "bean.xml";
		launch();
	}
	/*
	 * 以下方法为在windows下面的构建
	 public SpringBuid(){
	 	xml = StaticData.WEBINF_PATH + "bean.xml"
	 	launch();
	 }
	 */
	public void launch(){
		ctx = new FileSystemXmlApplicationContext(xml);
	}
	
	public Object action(String bean){
		Object action = ctx.getBean(bean);
		return action;
	}
}
